package com.cdtye.itps.cms.service.algorithm;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cdtye.common.mybatiscore.base.BaseService;
import com.cdtye.common.webcore.constants.WebConstants;
import com.cdtye.itps.cms.dao.algorithm.entity.JcjcAlgorithmOperateLog;
import com.cdtye.itps.cms.dao.algorithm.vo.JcjcAlgorithmOperateLogVo;
import com.cdtye.itps.cms.mapper.algorithm.JcjcAlgorithmOperateLogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Author: wangzhong
 * @Date: 2023/9/12 14:28
 * @Description: 算法操作日志表 服务类
 **/

@Service
public class JcjcAlgorithmOperateLogService extends BaseService<JcjcAlgorithmOperateLogMapper, JcjcAlgorithmOperateLog> {

    @Autowired
    private JcjcAlgorithmOperateLogMapper modelMapper;

    /**
     * 列表查询
     * @param vo
     * @return
     */
    public List<JcjcAlgorithmOperateLog> list(JcjcAlgorithmOperateLogVo vo){
        LambdaQueryWrapper<JcjcAlgorithmOperateLog> wrapper = new LambdaQueryWrapper<>();
        //添加查询条件

        //物理删除表,查询非删除状态包括null
        wrapper.and(i->i.eq(JcjcAlgorithmOperateLog::getDelFlag, WebConstants.NO).or().isNull(JcjcAlgorithmOperateLog::getDelFlag));
        return list(wrapper);
    }

    /**
     * 分页查询，自定义sql语句
     * @param vo
     * @return
     */
    public IPage<Map<String,Object>> listPage(JcjcAlgorithmOperateLogVo vo){
        return modelMapper.list(vo.page(), vo);
    }

}